<template>
	<view>
		<!-- 搜索无记录 -->
		<zy-empty v-if="this.infoList.length==0"></zy-empty>
		<view v-else>
			<!-- 返回顶部 -->
			<u-back-top :scroll-top="scrollTop"></u-back-top>
			<infoList :infoList="infoList"></infoList>
		</view>
	</view>
</template>

<script>
	import {
		getWarehouseApply
	} from "@/api/homepage.js"
	import infoList from './components/infoList.vue'
	export default {
		components: {
			infoList
		},
		data() {
			return {
				scrollTop: 0,
				infoList: []
			}
		},
		onPullDownRefresh() {
			setTimeout(function() {
				uni.redirectTo({
					url: "/pages/HomePage/StoreManagement/AccessoryManagement/Requisition/index"
				})
				uni.stopPullDownRefresh();
			}, 1000);
		},
		onLoad() {
			this.getWarehouseApplyList()
		},
		methods: {
			//返回顶部
			onPageScroll(e) {
				this.scrollTop = e.scrollTop;
			},
			getWarehouseApplyList() {
				getWarehouseApply({
					checkStatus: 0,
				}).then((res) => {
					if (res.code == 0) {
						for (var i = 0; i < res.data.length; i++) {
							let requistionInfoGood = {
								id: res.data[i].id,
								billNo: res.data[i].bill_no, //单据编号								
								billNum: res.data[i].apply_num, //申请数量
								billStatus: res.data[i].status, //状态
								applyDeptName: res.data[i].apply_dept_id, //申请部门
								billUserName: res.data[i].bill_user_name, //申请人
								billDate: res.data[i].bill_date, //申请日期
							}
							this.infoList.push(requistionInfoGood)
						}
					} else {
						uni.showToast({
							title: res.message,
							icon: "none",
							duration: 3000
						})
					}
				})
			},
		}
	};
</script>

<style lang="scss" scoped>
</style>
